{include file='../Public/header.tpl'}
<link href="/Public/Home/css/member.css" rel="stylesheet" type="text/css" media="screen" />
<script src="/Public/jquery.js"></script>
{literal}
<script>
	$(function(){
		var url='/index.php/Home/Member/ajaxbuy';
		$('.decrCart').on('click',function(){
			var id=$(this).next(':first')[0].name;
			$.post(url,{'goodsID':id,'flag':'decr'},function(msg){
				if(msg){
					window.location.href='';
				}
			},'json');
		});
		$('.addCart').on('click',function(){
			var id=$(this).prev(':first')[0].name;
			$.post(url,{'goodsID':id,'flag':'add'},function(msg){
				if(msg){
					window.location.href='';
				}
			},'json');
		});
	});
</script>
{/literal}
<div class="content">
	<div class="user">
		<div class="menu">当前位置: <span><a href=".">首页</a> <code>&gt;</code> 购物流程</span></div>
		<form id="formCart" name="formCart" method="post" action="flow.php">
		<div class="shop">
			<div class="linebt"><span><img src="/Public/Home/images/cart.jpg" align="absmiddle" />我的购物车</span><em></em></div>
			<ul class="shop_b">
				<li class="shop_num">序号</li>
				<li class="shop_pic">　</li>
				<li class="shop_name">商品名称</li>
				<li class="shop_color">颜色</li>
				<li class="shop_nu">购买数量</li>
				<li class="shop_much">本店价</li>
				<li class="shop_sum">小计</li>
				<li class="shop_oper">操作</li>
				<div class="clear"></div>
			</ul>
			<ul class="ulcart">

{if isset($smarty.session.Cart)}
{counter print=false assign=i start=0}
{foreach from=$smarty.session.Cart item=val}
{counter}
				<li class="shop_num">{$i}</li>
				<li class="shop_pic">
					<div class="promin_mainpic">
						<div class="promin_mainpicn">
						<a href="/index.php/Home/Index/goods/id/{$val.goodsID}" target="_blank"><img src="/Public/Admin/upload/{$val.photo}" border="0" title="{$val.name}" /></a><br />
						<i></i>
						</div>
					</div>
				</li>
				<li class="shop_name">
					 <a href="/index.php/Home/Index/goods/id/{$val.goodsID}" target="_blank">{$val.name}</a>
				</li>
				<li class="shop_color">&nbsp;随机</li>
				<li class="shop_nu">
					<img src="/Public/Home/images/bag_close.gif" class="decrCart" />
                    <input type="text"  class="input_num" name="{$val.goodsID}" value="{$val.num}" size="4" style="text-align:center"  />
                    <img src="/Public/Home/images/bag_open.gif" class="addCart" />
				</li>
				<li class="shop_much">￥{$val.price}元</li>
				<li class="shop_sum">￥
				{$amount=$val.price*$val.num}
				{$total=$total+$amount}
				{$amount}元</li>
				<li class="shop_oper">
				<a href="/index.php/Home/Member/delcart/id/{$val.goodsID}" onclick="javascript:confirm('您确实要把该商品移出购物车吗？')" class="f6">删除</a>
										<a href="javascript:if (confirm('您确实要把该商品移出购物车吗？')) location.href='flow.php?step=drop_to_collect&amp;id=44'; " class="f6">放入收藏夹</a>
									</li>
				<div class="clear"></div>
{/foreach}
{/if}
			</ul>
						<div class="contno">
				<span>购物金额小计 ￥{if isset($total)}{$total}{else}0{/if}元，比市场价 ￥{$marketTotal}元 节省了 ￥{if isset($total)&&isset($marketTotal)}{$marketTotal-$total}{/if}元	</span>
			</div>
			<div class="shop_bot">
				<span class="left"></span>
				<span class="right">
					<input type="hidden" name="step" value="update_cart" />
					<input type="button" value="继续购物" class="button_shop" style="cursor:pointer" onClick="location.href='/index.php/Home/Index/index';">
					<input type="button" value="开始结算" style="cursor:pointer" class="buttonredb" onClick="if ({$goodsNUMs}==0) {literal}{alert('您还没有添加商品，无法进行结算。');return;}{/literal}window.location.href='/index.php/Home/Member/cart_checkout'">
				</span>
				<span class="clear"></span>
			</div>
		</div>
		<div class="clear"></div>
  		</form>
		
		
		
		
			</div>
</div>
{include file='../Public/footer.tpl'}